/******************************************************************************* 
 *  Copyright 2007 Amazon Technologies, Inc.  
 *  Licensed under the Apache License, Version 2.0 (the "License"); 
 *  
 *  You may not use this file except in compliance with the License. 
 *  You may obtain a copy of the License at: http://aws.amazon.com/apache2.0
 *  This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR 
 *  CONDITIONS OF ANY KIND, either express or implied. See the License for the 
 *  specific language governing permissions and limitations under the License.
 * ***************************************************************************** 
 *    __  _    _  ___ 
 *   (  )( \/\/ )/ __)
 *   /__\ \    / \__ \
 *  (_)(_) \/\/  (___/
 * 
 *  Amazon ECS CSharp Library
 *  API Version: 2007-07-16
 *  Generated: Thu Aug 02 10:15:38 PDT 2007 
 * 
 */

using System;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Text;


namespace Amazon.ECS.Model
{
    [XmlTypeAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16")]
    [XmlRootAttribute(Namespace = "http://webservices.amazon.com/AWSECommerceService/2007-07-16", IsNullable = false)]
    public class OfferSummary
    {
    
        private  Price lowestNewPriceField;
        private  Price lowestUsedPriceField;
        private  Price lowestCollectiblePriceField;
        private  Price lowestRefurbishedPriceField;
        private String totalNewField;

        private String totalUsedField;

        private String totalCollectibleField;

        private String totalRefurbishedField;


        /// <summary>
        /// Gets and sets the LowestNewPrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "LowestNewPrice")]
        public Price LowestNewPrice
        {
            get { return this.lowestNewPriceField ; }
            set { this.lowestNewPriceField = value; }
        }



        /// <summary>
        /// Sets the LowestNewPrice property
        /// </summary>
        /// <param name="lowestNewPrice">LowestNewPrice property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithLowestNewPrice(Price lowestNewPrice)
        {
            this.lowestNewPriceField = lowestNewPrice;
            return this;
        }



        /// <summary>
        /// Checks if LowestNewPrice property is set
        /// </summary>
        /// <returns>true if LowestNewPrice property is set</returns>
        public Boolean IsSetLowestNewPrice()
        {
            return this.lowestNewPriceField != null;
        }




        /// <summary>
        /// Gets and sets the LowestUsedPrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "LowestUsedPrice")]
        public Price LowestUsedPrice
        {
            get { return this.lowestUsedPriceField ; }
            set { this.lowestUsedPriceField = value; }
        }



        /// <summary>
        /// Sets the LowestUsedPrice property
        /// </summary>
        /// <param name="lowestUsedPrice">LowestUsedPrice property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithLowestUsedPrice(Price lowestUsedPrice)
        {
            this.lowestUsedPriceField = lowestUsedPrice;
            return this;
        }



        /// <summary>
        /// Checks if LowestUsedPrice property is set
        /// </summary>
        /// <returns>true if LowestUsedPrice property is set</returns>
        public Boolean IsSetLowestUsedPrice()
        {
            return this.lowestUsedPriceField != null;
        }




        /// <summary>
        /// Gets and sets the LowestCollectiblePrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "LowestCollectiblePrice")]
        public Price LowestCollectiblePrice
        {
            get { return this.lowestCollectiblePriceField ; }
            set { this.lowestCollectiblePriceField = value; }
        }



        /// <summary>
        /// Sets the LowestCollectiblePrice property
        /// </summary>
        /// <param name="lowestCollectiblePrice">LowestCollectiblePrice property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithLowestCollectiblePrice(Price lowestCollectiblePrice)
        {
            this.lowestCollectiblePriceField = lowestCollectiblePrice;
            return this;
        }



        /// <summary>
        /// Checks if LowestCollectiblePrice property is set
        /// </summary>
        /// <returns>true if LowestCollectiblePrice property is set</returns>
        public Boolean IsSetLowestCollectiblePrice()
        {
            return this.lowestCollectiblePriceField != null;
        }




        /// <summary>
        /// Gets and sets the LowestRefurbishedPrice property.
        /// </summary>
        [XmlElementAttribute(ElementName = "LowestRefurbishedPrice")]
        public Price LowestRefurbishedPrice
        {
            get { return this.lowestRefurbishedPriceField ; }
            set { this.lowestRefurbishedPriceField = value; }
        }



        /// <summary>
        /// Sets the LowestRefurbishedPrice property
        /// </summary>
        /// <param name="lowestRefurbishedPrice">LowestRefurbishedPrice property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithLowestRefurbishedPrice(Price lowestRefurbishedPrice)
        {
            this.lowestRefurbishedPriceField = lowestRefurbishedPrice;
            return this;
        }



        /// <summary>
        /// Checks if LowestRefurbishedPrice property is set
        /// </summary>
        /// <returns>true if LowestRefurbishedPrice property is set</returns>
        public Boolean IsSetLowestRefurbishedPrice()
        {
            return this.lowestRefurbishedPriceField != null;
        }




        /// <summary>
        /// Gets and sets the TotalNew property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalNew")]
        public String TotalNew
        {
            get { return this.totalNewField ; }
            set { this.totalNewField= value; }
        }



        /// <summary>
        /// Sets the TotalNew property
        /// </summary>
        /// <param name="totalNew">TotalNew property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithTotalNew(String totalNew)
        {
            this.totalNewField = totalNew;
            return this;
        }



        /// <summary>
        /// Checks if TotalNew property is set
        /// </summary>
        /// <returns>true if TotalNew property is set</returns>
        public Boolean IsSetTotalNew()
        {
            return  this.totalNewField != null;

        }


        /// <summary>
        /// Gets and sets the TotalUsed property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalUsed")]
        public String TotalUsed
        {
            get { return this.totalUsedField ; }
            set { this.totalUsedField= value; }
        }



        /// <summary>
        /// Sets the TotalUsed property
        /// </summary>
        /// <param name="totalUsed">TotalUsed property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithTotalUsed(String totalUsed)
        {
            this.totalUsedField = totalUsed;
            return this;
        }



        /// <summary>
        /// Checks if TotalUsed property is set
        /// </summary>
        /// <returns>true if TotalUsed property is set</returns>
        public Boolean IsSetTotalUsed()
        {
            return  this.totalUsedField != null;

        }


        /// <summary>
        /// Gets and sets the TotalCollectible property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalCollectible")]
        public String TotalCollectible
        {
            get { return this.totalCollectibleField ; }
            set { this.totalCollectibleField= value; }
        }



        /// <summary>
        /// Sets the TotalCollectible property
        /// </summary>
        /// <param name="totalCollectible">TotalCollectible property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithTotalCollectible(String totalCollectible)
        {
            this.totalCollectibleField = totalCollectible;
            return this;
        }



        /// <summary>
        /// Checks if TotalCollectible property is set
        /// </summary>
        /// <returns>true if TotalCollectible property is set</returns>
        public Boolean IsSetTotalCollectible()
        {
            return  this.totalCollectibleField != null;

        }


        /// <summary>
        /// Gets and sets the TotalRefurbished property.
        /// </summary>
        [XmlElementAttribute(ElementName = "TotalRefurbished")]
        public String TotalRefurbished
        {
            get { return this.totalRefurbishedField ; }
            set { this.totalRefurbishedField= value; }
        }



        /// <summary>
        /// Sets the TotalRefurbished property
        /// </summary>
        /// <param name="totalRefurbished">TotalRefurbished property</param>
        /// <returns>this instance</returns>
        public OfferSummary WithTotalRefurbished(String totalRefurbished)
        {
            this.totalRefurbishedField = totalRefurbished;
            return this;
        }



        /// <summary>
        /// Checks if TotalRefurbished property is set
        /// </summary>
        /// <returns>true if TotalRefurbished property is set</returns>
        public Boolean IsSetTotalRefurbished()
        {
            return  this.totalRefurbishedField != null;

        }




        /// <summary>
        /// XML fragment representation of this object
        /// </summary>
        /// <returns>XML fragment for this object.</returns>
        /// <remarks>
        /// Name for outer tag expected to be set by calling method. 
        /// This fragment returns inner properties representation only
        /// </remarks>


        protected internal String ToXMLFragment() {
            StringBuilder xml = new StringBuilder();
            if (IsSetLowestNewPrice()) {
                Price  lowestNewPrice = this.LowestNewPrice;
                xml.Append("<LowestNewPrice>");
                xml.Append(lowestNewPrice.ToXMLFragment());
                xml.Append("</LowestNewPrice>");
            } 
            if (IsSetLowestUsedPrice()) {
                Price  lowestUsedPrice = this.LowestUsedPrice;
                xml.Append("<LowestUsedPrice>");
                xml.Append(lowestUsedPrice.ToXMLFragment());
                xml.Append("</LowestUsedPrice>");
            } 
            if (IsSetLowestCollectiblePrice()) {
                Price  lowestCollectiblePrice = this.LowestCollectiblePrice;
                xml.Append("<LowestCollectiblePrice>");
                xml.Append(lowestCollectiblePrice.ToXMLFragment());
                xml.Append("</LowestCollectiblePrice>");
            } 
            if (IsSetLowestRefurbishedPrice()) {
                Price  lowestRefurbishedPrice = this.LowestRefurbishedPrice;
                xml.Append("<LowestRefurbishedPrice>");
                xml.Append(lowestRefurbishedPrice.ToXMLFragment());
                xml.Append("</LowestRefurbishedPrice>");
            } 
            if (IsSetTotalNew()) {
                xml.Append("<TotalNew>");
                xml.Append(EscapeXML(this.TotalNew));
                xml.Append("</TotalNew>");
            }
            if (IsSetTotalUsed()) {
                xml.Append("<TotalUsed>");
                xml.Append(EscapeXML(this.TotalUsed));
                xml.Append("</TotalUsed>");
            }
            if (IsSetTotalCollectible()) {
                xml.Append("<TotalCollectible>");
                xml.Append(EscapeXML(this.TotalCollectible));
                xml.Append("</TotalCollectible>");
            }
            if (IsSetTotalRefurbished()) {
                xml.Append("<TotalRefurbished>");
                xml.Append(EscapeXML(this.TotalRefurbished));
                xml.Append("</TotalRefurbished>");
            }
            return xml.ToString();
        }

        /**
         * 
         * Escape XML special characters
         */
        private String EscapeXML(String str) {
            StringBuilder sb = new StringBuilder();
            foreach (Char c in str)
            {
                switch (c) {
                case '&':
                    sb.Append("&amp;");
                    break;
                case '<':
                    sb.Append("&lt;");
                    break;
                case '>':
                    sb.Append("&gt;");
                    break;
                case '\'':
                    sb.Append("&#039;");
                    break;
                case '"':
                    sb.Append("&quot;");
                    break;
                default:
                    sb.Append(c);
                    break;
                }
            }
            return sb.ToString();
        }




    }

}